#ifndef _FINDDIALOG_H_
#define _FINDDIALOG_H_

#include <QtGui/QWidget>

class QLineEdit;
class QToolButton;
class QLabel;
class QMenu;
class QAction;
class Editor;
class QPushButton;

class FindReplaceWidget : public QWidget
{
	Q_OBJECT
	public slots:
		void setCurrentEditor(Editor *currentEditor);
	public:
		FindReplaceWidget(QWidget *parent = 0);
		~FindReplaceWidget();

		void saveSettings();
		void loadSettings();
	private slots:
		void find();
		void findPrevious();
		void replace();
		void replaceAll();
		
		void findSettingsChanged();
		
		void findTextChanged(const QString& findText);
	private:
		QPalette defaultPalette;
		QPalette redPalette;
		QPalette greenPalette;
		
		Editor *currentEditor;
		
		QLineEdit *findLine;
		QLabel *replaceLabel;
		QLineEdit *replaceLine;
	
		QLabel *messageLabel;
		
		QMenu *optionsMenu;
		QAction *matchCaseAction;
		QAction *backwardAction;
		QAction *regularExpAction;
		QAction *wholeWordAction;
		QAction *fromCursorAction;
	
		QToolButton *findButton;
		QToolButton *findPreviousButton;
		QToolButton *replaceButton;
		QToolButton *cancelButton;
		QToolButton *optionsButton;
		QPushButton *replaceAllButton;
		
		int replaceCount;
		int findCount;
	protected:
		void showEvent(QShowEvent *);
};

#endif
